{block name="content"}
<div class="think-box-shadow relative padding-top-0 shadow-none">
    <table id="CateTableSelect" data-url="{:request()->url()}" data-target-search="form.form-search"></table>
</div>

<script>
    $(function () {
        $('#CateTableSelect').layTable({
            even: true, height: 'full', page: false,
            sort: {field: 'sort desc,id', type: 'asc'},
            cols: [[
                {checkbox: true, fixed: true, hide: true},
                {field: 'sort', hide: true},
                {field: 'name', title: '分类名称', minWidth: 220, templet: '<div><span class="color-desc">{{d.spl}}</span>{{d.name}}</div>'},
                {field: 'create_time', title: '创建时间', width: 170, align: 'center'},
                {toolbar: '#SelectToolbar', title: '操作面板', width: 160, align: 'center', fixed: 'right'},
            ]]
        }).trigger('tool', function (item) {
            let attr = ['商品分类', item.data.id, item.data.name];
            window.setItemValue(item.data, attr.join('#'));
            $.msg.closeThisModal(this);
        });
    });
</script>

<!-- 操作工具条模板 -->
<script type="text/html" id="SelectToolbar">
    {{# if (typeof checkItemValue !== 'function' || checkItemValue(d.id)){ }}
    <a class="layui-btn layui-btn-sm" lay-event="select">选 择</a>
    {{# }else{ }}
    <a class="layui-btn layui-btn-sm layui-btn-disabled">已 选</a>
    {{# } }}
</script>
{/block}
